<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>定时器</title>
    <style>
        body{
            background: url("images/time/bg.png") no-repeat;
            background-size: cover;
            color: white;
            font-size: 50px;;
        }
        a{text-decoration: line-through }
        #wrap{width: 500px;margin: 150px auto;}
        #Every-minute{margin-top: 150px;text-align: center }
    </style>
</head>
<body>
<a href="">12313212</a>
<div id="wrap">
    <div id="Specific-date">
        <img src="images/time/2.png" alt="">
        <img src="images/time/0.png" alt="">
        <img src="images/time/1.png" alt="">
        <img src="images/time/6.png" alt="">
        :
        <img src="images/time/1.png" alt="">
        <img src="images/time/1.png" alt="">
        :
        <img src="images/time/0.png" alt="">
        <img src="images/time/7.png" alt="">
    </div>
    <div id="Every-minute">
    <img src="images/time/0.png" alt="">
    <img src="images/time/0.png" alt="">
    :
    <img src="images/time/0.png" alt="">
    <img src="images/time/0.png" alt="">
    :
    <img src="images/time/0.png" alt="">
    <img src="images/time/0.png" alt="">
</div>
</div>

<script>
    function toDou(obj){
        if (obj<10){
            return "0"+obj;
        }else{
            return ""+obj;
        }
    }
    window.onload= function () {
        /*年月日*/
        var oSpecificDate=document.getElementById("Specific-date");
        var aImgs=oSpecificDate.getElementsByTagName("img");
        function a(){
            var date = new Date();
            var year = date.getFullYear();
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (strDate >= 0 && strDate <= 9) {
                strDate = "0" + strDate;
            }
            alert(year+"年"+month+"月"+strDate+"日");
        }

       // var oEvery=document.getElementById("Every-minute");
        var oEvery=document.getElementById("wrap");
        var aImg=oEvery.getElementsByTagName("img");
        function show(){
            var oDate=new Date();//获取当地时间
            var str=oDate.getFullYear()+toDou(oDate.getMonth()+1)+toDou(oDate.getDate())+toDou(oDate.getHours())+toDou(oDate.getMinutes())+toDou(oDate.getSeconds())
            for (var i=0;i<aImg.length;i++){
                aImg[i].src="images/time/"+str.charAt(i)+".png"
            }
        }
      setInterval(show,1000);
       show()


    }
</script>
</body>
</html>